<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-alpha.72">
<link rel="alternate" type="application/rss+xml" href="/zh-cn.neutralinojs.github.io/blog/rss.xml" title="Neutralinojs Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/zh-cn.neutralinojs.github.io/blog/atom.xml" title="Neutralinojs Blog Atom Feed">
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-120983955-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-120983955-1",{anonymize_ip:!0})</script>
<script src="https://media.ethicalads.io/media/client/ethicalads.min.js"></script>
<script src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" async></script><title data-react-helmet="true">neu CLI | Neutralinojs</title><meta data-react-helmet="true" property="og:url" content="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/cli/neu-cli"><meta data-react-helmet="true" name="docusaurus_locale" content="en"><meta data-react-helmet="true" name="docusaurus_version" content="current"><meta data-react-helmet="true" name="docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:title" content="neu CLI | Neutralinojs"><meta data-react-helmet="true" name="description" content="npm"><meta data-react-helmet="true" property="og:description" content="npm"><link data-react-helmet="true" rel="shortcut icon" href="/zh-cn.neutralinojs.github.io/img/favicon.png"><link data-react-helmet="true" rel="canonical" href="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/cli/neu-cli"><link data-react-helmet="true" rel="alternate" href="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/cli/neu-cli" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/cli/neu-cli" hreflang="x-default"><link rel="stylesheet" href="/zh-cn.neutralinojs.github.io/assets/css/styles.b7ecac1c.css">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/styles.c25d7c9f.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/runtime~main.da1bdab8.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/main.22927eab.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/1.a80d899d.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/2.818fc9a7.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/49.8e895b96.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/50.816652b0.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/935f2afb.a67ede05.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/17896441.74f92a0c.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/03c05485.bb541070.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div><a href="#main" class="skipToContent_1oUP">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle" type="button" tabindex="0"><svg aria-label="Menu" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/zh-cn.neutralinojs.github.io/"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><strong class="navbar__title">Neutralinojs</strong></a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/zh-cn.neutralinojs.github.io/docs/">文档</a><a class="navbar__item navbar__link" href="/zh-cn.neutralinojs.github.io/apps/">应用</a><a class="navbar__item navbar__link" href="/zh-cn.neutralinojs.github.io/resources/">资源</a><a href="https://www.youtube.com/c/CodeZri" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">视频</a><a href="https://codezri.org/blog/neutralinojs-2024-roadmap" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">路线图</a><a class="navbar__item navbar__link" href="/zh-cn.neutralinojs.github.io/docs/release-notes/framework">发布说明</a><a href="https://github.com/neutralinojs/gsoc2024" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GSoC 2024</a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub</a><a href="https://www.patreon.com/shalithasuranga" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">❤️ 捐赠</a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_GrZ2"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_71bT">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_71bT">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/zh-cn.neutralinojs.github.io/"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><strong class="navbar__title">Neutralinojs</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link navbar__link--active" href="/zh-cn.neutralinojs.github.io/docs/">文档</a></li><li class="menu__list-item"><a class="menu__link" href="/zh-cn.neutralinojs.github.io/apps/">应用</a></li><li class="menu__list-item"><a class="menu__link" href="/zh-cn.neutralinojs.github.io/resources/">资源</a></li><li class="menu__list-item"><a href="https://www.youtube.com/c/CodeZri" target="_blank" rel="noopener noreferrer" class="menu__link">视频</a></li><li class="menu__list-item"><a href="https://codezri.org/blog/neutralinojs-2024-roadmap" target="_blank" rel="noopener noreferrer" class="menu__link">路线图</a></li><li class="menu__list-item"><a class="menu__link" href="/zh-cn.neutralinojs.github.io/docs/release-notes/framework">发布说明</a></li><li class="menu__list-item"><a href="https://github.com/neutralinojs/gsoc2024" target="_blank" rel="noopener noreferrer" class="menu__link">GSoC 2024</a></li><li class="menu__list-item"><a href="https://github.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="menu__link">GitHub</a></li><li class="menu__list-item"><a href="https://www.patreon.com/shalithasuranga" target="_blank" rel="noopener noreferrer" class="menu__link">❤️ 捐赠</a></li></ul></div></div></div></nav><div class="main-wrapper main-docs-wrapper"><div class="docPage_31aa"><div class="docSidebarContainer_3Kbt" role="complementary"><div class="sidebar_15mo"><div class="menu menu--responsive thin-scrollbar menu_Bmed"><button aria-label="Open menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_fgN0" width="24" height="24" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">入门指南</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/">简介</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/getting-started/your-first-neutralinojs-app">您的第一个Neutralinojs应用</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/getting-started/using-frontend-libraries">使用前端库</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">原生 API</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/overview">原生API概览</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/app">Neutralino.app</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/clipboard">Neutralino.clipboard</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/computer">Neutralino.computer</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/custom">Neutralino.custom</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/debug">Neutralino.debug</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/events">Neutralino.events</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/extensions">Neutralino.extensions</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/filesystem">Neutralino.filesystem</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/init">Neutralino.init</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/os">Neutralino.os</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/storage">Neutralino.storage</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/updater">Neutralino.updater</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/window">Neutralino.window</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/error-codes">错误码</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/global-variables">全局变量</a></li></ul></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">CLI</a><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/zh-cn.neutralinojs.github.io/docs/cli/neu-cli">neu CLI</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/zh-cn.neutralinojs.github.io/docs/cli/internal-cli-arguments">Internal 命令行参数</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">配置</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/configuration/neutralino.config.json">neutralino.config.json</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/configuration/project-structure">项目结构</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/configuration/modes">模式</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">如何操作</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/how-to/extensions-overview">扩展概述</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/how-to/auto-updater">自动更新器</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">分发</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/distribution/overview">分发概述</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">贡献</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/framework-developer-guide">框架开发指南</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/architecture">架构</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/security">安全性</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/code-style-guide">代码风格指南</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/developer-support">开发者支持</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/committers">提交者</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/frequently-asked-questions">常见问题解答</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/about-neutralinojs">关于 Neutralinojs</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">发布说明</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/release-notes/framework">框架</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/release-notes/cli">命令行</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/release-notes/client-library">客户端</a></li></ul></li></ul></div></div></div><main class="docMainContainer_3ufF"><div class="container padding-vert--lg docItemWrapper_3FMP"><div class="row"><div class="col docItemCol_2rXS"><div class="docItemContainer_1EXp"><article><header><h1 class="docTitle_1vX4">neu CLI</h1></header><div class="markdown"><p><img src="https://img.shields.io/npm/v/@neutralinojs/neu" alt="npm">
<img src="https://img.shields.io/npm/dt/@neutralinojs/neu" alt="npm"></p><p>您可以使用 neu 命令行工具（CLI）轻松创建、运行和构建 Neutralinojs 应用程序。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="installation"></a>Installation<a class="hash-link" href="#installation" title="Direct link to heading">#</a></h2><p>在您的终端运行以下命令全局安装 CLI。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly bash"><div tabindex="0" class="prism-code language-bash codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token function" style="color:rgb(130, 170, 255)">npm</span><span class="token plain"> i -g @neutralinojs/neu</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>如果您不想进行全局安装，也可以通过 npx 使用 neu CLI。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly bash"><div tabindex="0" class="prism-code language-bash codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain">npx @neutralinojs/neu </span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">command</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="commands"></a>Commands<a class="hash-link" href="#commands" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="neu-create-binaryname"></a><code>neu create &lt;binaryName&gt;</code><a class="hash-link" href="#neu-create-binaryname" title="Direct link to heading">#</a></h3><p>基于模板创建一个新的 Neutralinojs 应用程序。</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="parameters"></a>Parameters<a class="hash-link" href="#parameters" title="Direct link to heading">#</a></h4><ul><li><code>&lt;binaryName&gt;</code>：您应用程序的二进制文件名。例如，如果您使用 <code>myapp</code>，
最终的应用程序二进制文件将成为 <code>myapp-&lt;platform&gt;_&lt;arch&gt;</code>。</li></ul><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="options"></a>Options<a class="hash-link" href="#options" title="Direct link to heading">#</a></h4><ul><li><code>--template</code>：通过 GitHub 仓库标识符 <code>&lt;account&gt;/&lt;repo&gt;</code> 格式设置应用程序模板。
默认值是 <a href="https://github.com/neutralinojs/neutralinojs-minimal" target="_blank" rel="noopener noreferrer"><code>neutralinojs/neutralinojs-minimal</code></a></li></ul><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="neu-build"></a><code>neu build</code><a class="hash-link" href="#neu-build" title="Direct link to heading">#</a></h3><p>该命令将创建 <code>dist</code> 文件夹。然后，它将为所有支持的平台生成二进制文件和从您的应用程序资源生成 <code>resources.neu</code> 资源文件。</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="options-1"></a>Options<a class="hash-link" href="#options-1" title="Direct link to heading">#</a></h4><ul><li><code>--release</code>：创建应用程序捆绑包的便携式 ZIP 文件。</li><li><code>--copy-storage</code>：将 Neutralinojs 存储的当前快照复制到应用程序捆绑包中。</li></ul><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="neu-run"></a><code>neu run</code><a class="hash-link" href="#neu-run" title="Direct link to heading">#</a></h3><p>执行当前应用程序（这将根据您的操作系统执行特定的二进制文件）。
该命令将在 Linux 和 macOS 上更改二进制文件的执行权限（使用 <code>chmod</code> 命令）。
此外，它还为当前应用程序启用了自动重新加载功能。
换句话说，当对应用程序资源进行修改时，
Neutralinojs 应用程序将自动重新加载。</p><p>您可以在应用程序运行时看到 Neutralinojs 进程和扩展输出流。</p><p>如果您在应用程序配置中使用了 <a href="/zh-cn.neutralinojs.github.io/docs/configuration/neutralino.config.json#clifrontendlibrary-object"><code>cli.frontendLibrary</code></a> 键，
CLI 将同时启用前端库的开发环境和 Neutralinojs 的开发环境。此选项会用 Neutralinojs 客户端库的全局变量修补主 HTML 文件，以将本地 API 暴露给前端库的开发服务器。
从<a href="/zh-cn.neutralinojs.github.io/docs/getting-started/using-frontend-libraries">这个</a>指南学习如何设置此功能。</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="options-2"></a>Options<a class="hash-link" href="#options-2" title="Direct link to heading">#</a></h4><ul><li><code>--disable-auto-reload</code>：禁用自动重新加载功能。</li><li><code>--arch=&lt;arch&gt;</code>：显式设置 CPU 架构。如果您在 64 位计算机上使用 32 位 Node.js 进程，此选项会很有帮助。</li><li><code>-- &lt;process-args&gt;</code>：为 Neutralinojs 应用程序进程设置额外的 CLI 参数。例如，您可以通过输入 <code>neu run -- --mode=browser</code> 启用 <code>browser</code> 模式。从<a href="/zh-cn.neutralinojs.github.io/docs/cli/internal-cli-arguments">这里</a>查看所有接受的参数。</li></ul><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="neu-update"></a><code>neu update</code><a class="hash-link" href="#neu-update" title="Direct link to heading">#</a></h3><p>该命令将从互联网更新现有的 Neutralinojs 二进制文件和客户端库。您可以在 <code>neutralino.config.json</code> 文件的 <code>cli.binaryVersion</code> 和 <code>cli.clientVersion</code> 中使用 <code>nightly</code> 标签，以使用实验性的每日预发布版本。</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="options-3"></a>Options<a class="hash-link" href="#options-3" title="Direct link to heading">#</a></h4><ul><li><code>--latest</code>：通过 GitHub API 获取最新框架版本详细信息，从官方发布中下载，并使用获取的版本详细信息更新应用程序配置。</li></ul><div class="admonition admonition-warning alert alert--danger"><div class="admonition-heading"><h5><span class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="16" viewBox="0 0 12 16"><path fill-rule="evenodd" d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"></path></svg></span>warning</h5></div><div class="admonition-content"><p>夜间构建指的是自动生成的每日构建，因此这些构建可能包含实验性或不完整的功能。因此，请避免在您的生产应用程序中使用 <code>nightly</code> 版本。使用 <code>nightly</code> 版本可以尝试最新功能，但生产应用程序应使用稳定版本。</p></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="neu-version"></a><code>neu version</code><a class="hash-link" href="#neu-version" title="Direct link to heading">#</a></h3><p>打印所有版本信息。如果此命令是从 Neutralinojs 应用程序目录执行的，
您将看到特定于项目的版本详细信息。否则，您将看到全局版本详细信息。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="neu-plugins-plugin"></a><code>neu plugins [plugin]</code><a class="hash-link" href="#neu-plugins-plugin" title="Direct link to heading">#</a></h3><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="parameters-1"></a>Parameters<a class="hash-link" href="#parameters-1" title="Direct link to heading">#</a></h4><ul><li><code>plugin</code>：插件标识符。这个值通常是 npm 包标识符。</li></ul><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="options-4"></a>Options<a class="hash-link" href="#options-4" title="Direct link to heading">#</a></h4><ul><li><code>--add</code>：向 neu CLI 注册新插件。neu CLI 将插件下载到 CLI 的 <code>node_modules</code>
目录，并在引导过程中加载。插件可以向 CLI 引入新命令。</li><li><code>--remove</code>：取消注册现有插件。</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="plugins"></a>Plugins<a class="hash-link" href="#plugins" title="Direct link to heading">#</a></h2><p>Neutralinojs 应用程序开发人员可以编写插件，为 neu CLI 添加他们自己的命令。
您可以通过以下步骤开发 CLI 插件。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="developing-a-plugin"></a>Developing a plugin<a class="hash-link" href="#developing-a-plugin" title="Direct link to heading">#</a></h3><p>neu CLI 将使用 <code>index.js</code> 作为接口来注册插件。创建一个带有 <code>index.js</code> 的新 npm 包，并
添加以下代码片段。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly js"><div tabindex="0" class="prism-code language-js codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// index.js</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">module</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token property-access">exports</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  command</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&#x27;commandname &lt;action&gt;&#x27;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  </span><span class="token function-variable function" style="color:rgb(130, 170, 255)">register</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token parameter">command</span><span class="token parameter punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token parameter"> modules</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:rgb(137, 221, 255)">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    command</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token method function property-access" style="color:rgb(130, 170, 255)">option</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token string" style="color:rgb(195, 232, 141)">&#x27;--option1 --option2&#x27;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">     </span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token method function property-access" style="color:rgb(130, 170, 255)">action</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token parameter">action</span><span class="token parameter punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token parameter"> command</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:rgb(137, 221, 255)">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">//你的逻辑放在这里..</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">     </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p><code>command</code> 是带有动作的 CLI 命令字符串。当插件正在注册时，将调用 <code>register</code> 函数。它同时具有命令对象和
<a href="https://github.com/neutralinojs/neutralinojs-cli/blob/master/src/modules/index.js" target="_blank" rel="noopener noreferrer">标准模块对象</a>
作为参数。请查看 <a href="https://www.npmjs.com/package/commander" target="_blank" rel="noopener noreferrer">commander</a> 包文档
了解更多关于命令和回调参数的信息。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="publishing-your-plugin"></a>Publishing your plugin<a class="hash-link" href="#publishing-your-plugin" title="Direct link to heading">#</a></h3><p>一旦您将插件作为公共包发布到 npm 注册表，任何人都将能够使用以下命令安装它：</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly bash"><div tabindex="0" class="prism-code language-bash codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain">neu plugins --add </span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">package-name</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>并且可以使用以下命令移除它：</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly bash"><div tabindex="0" class="prism-code language-bash codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token plain">neu plugins --remove </span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token plain">package-name</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>有关进一步的实现细节，请参见 <a href="https://github.com/neutralinojs/neutralinojs-cli-appify" target="_blank" rel="noopener noreferrer">Appify 插件源代码</a>。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="changelog"></a>Changelog<a class="hash-link" href="#changelog" title="Direct link to heading">#</a></h2><p>请从 <a href="https://github.com/neutralinojs/neutralinojs-cli/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer">GitHub</a> 查看更新日志。</p></div></article><div class="margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/neutralinojs/neutralinojs.github.io/edit/main/docs/cli/neu-cli.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" role="img" viewBox="0 0 40 40" class="iconEdit_2_ui" aria-label="Edit page"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Docs pages navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/zh-cn.neutralinojs.github.io/docs/api/global-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« 全局变量</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/zh-cn.neutralinojs.github.io/docs/cli/internal-cli-arguments"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Internal 命令行参数 »</div></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_1nbE thin-scrollbar"><div><div data-ea-publisher="neutralino" data-ea-type="image" id="neutralino-docs"></div></div><ul class="table-of-contents table-of-contents__left-border"><li><a href="#installation" class="table-of-contents__link">Installation</a></li><li><a href="#commands" class="table-of-contents__link">Commands</a><ul><li><a href="#neu-create-binaryname" class="table-of-contents__link"><code>neu create &lt;binaryName&gt;</code></a></li><li><a href="#neu-build" class="table-of-contents__link"><code>neu build</code></a></li><li><a href="#neu-run" class="table-of-contents__link"><code>neu run</code></a></li><li><a href="#neu-update" class="table-of-contents__link"><code>neu update</code></a></li><li><a href="#neu-version" class="table-of-contents__link"><code>neu version</code></a></li><li><a href="#neu-plugins-plugin" class="table-of-contents__link"><code>neu plugins [plugin]</code></a></li></ul></li><li><a href="#plugins" class="table-of-contents__link">Plugins</a><ul><li><a href="#developing-a-plugin" class="table-of-contents__link">Developing a plugin</a></li><li><a href="#publishing-your-plugin" class="table-of-contents__link">Publishing your plugin</a></li></ul></li><li><a href="#changelog" class="table-of-contents__link">Changelog</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">文档</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/">入门</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/api/overview">API参考</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/cli/neu-cli">CLI</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/configuration/modes">模式</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/contributing/framework-developer-guide">贡献</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">社区</h4><ul class="footer__items"><li class="footer__item"><a href="https://github.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li><li class="footer__item"><a href="https://twitter.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter</a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Overflow</a></li><li class="footer__item"><a href="https://medium.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">Medium</a></li><li class="footer__item"><a href="https://www.youtube.com/watch?v=txDlNNsgSh8&amp;list=PLvTbqpiPhQRb2xNQlwMs0uVV0IN8N-pKj&amp;ab_channel=CodeZri" target="_blank" rel="noopener noreferrer" class="footer__link-item">YouTube</a></li><li class="footer__item"><a href="https://join.slack.com/t/neutralinojs/shared_invite/zt-b7mbivj5-pKpO6U5drmeT68vKD_pc6w" target="_blank" rel="noopener noreferrer" class="footer__link-item">Slack</a></li><li class="footer__item"><a href="https://discord.gg/cybpp4guTJ" target="_blank" rel="noopener noreferrer" class="footer__link-item">Discord</a></li><li class="footer__item"><a href="https://www.reddit.com/r/neutralinojs/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Reddit</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">更多</h4><ul class="footer__items"><li class="footer__item"><a href="https://github.com/neutralinojs/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li><li class="footer__item"><a href="https://www.patreon.com/shalithasuranga" target="_blank" rel="noopener noreferrer" class="footer__link-item">Patreon</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/privacy-policy">隐私政策</a></li><li class="footer__item"><a href="https://codezri.org/blog/" target="_blank" rel="noopener noreferrer" class="footer__link-item">博客</a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2024 Neutralinojs | innovation by <a href="https://codezri.org/">CodeZri.org</a></div></div></div></footer></div>
<script src="/zh-cn.neutralinojs.github.io/assets/js/styles.c25d7c9f.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/runtime~main.da1bdab8.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/main.22927eab.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/1.a80d899d.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/2.818fc9a7.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/49.8e895b96.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/50.816652b0.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/935f2afb.a67ede05.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/17896441.74f92a0c.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/03c05485.bb541070.js"></script>
</body>
</html>